<template>
  <div class="header" @click="showDetail">
    <div class="content-wrapper">
      <div class="avatar">
        <img width="64" height="64" :src="seller.avatar" />
      </div>
      <div class="content">
        <div class="title">
          <span class="brand"></span>
          <span class="name">{{seller.name}}</span>
        </div>
        <div class="description">{{seller.description}} / {{seller.deliveryTime}}分钟送达</div>
        <div v-if="seller.supports" class="support">
          <support-ico :size="1" :type="seller.supports[0].type"></support-ico>
          <span class="text">{{seller.supports[0].description}}</span>
        </div>
      </div>
      <div v-if="seller.supports" class="support-count">
        <span class="count">{{seller.supports.length}}个</span>
        <i class="icon-keyboard_arrow_right"></i>
      </div>
    </div>
    <div class="bulletin-wrapper">
      <span class="bulletin-title"></span>
      <span class="bulletin-text">{{seller.bulletin}}</span>
      <i class="icon-keyboard_arrow_right"></i>
    </div>
    <div class="background">
      <img width="100%" height="100%" :src="seller.avatar" />
    </div>
  </div>
</template>

<script>
import SupportIco from '../support-ico/support-ico.vue'
export default {
  name: 'v-header',
  props: {
    seller: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  methods: {
    showDetail() {
      this.headerDetailComp = this.headerDetailComp || this.$createHeaderDetail({
        $props: {
          seller: 'seller'
        }
      })
      this.headerDetailComp.show()
    }
  },
  components: {
    SupportIco
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="stylus">
@import '../../common/stylus/variable'
@import '../../common/stylus/mixin'

.header
  position relative
  overflow hidden
  height 110px
  padding 24px 24px 0 24px
  background $color-background-ss
  .avatar
    img
      border-radius 2px
  .content-wrapper
    display flex
    .content
      margin-left 16px
      color $color-white
      .title
        .brand
          display inline-block
          vertical-align top
          width 30px
          height 18px
          bg-image('images/brand')
          background-size 30px 18px
          background-repeat no-repeat
        .name
          margin-left 6px
          font-size $fontsize-large
          font-weight bold
          line-height 18px
      .description
        margin 8px 0 0 0
        font-size $fontsize-small
        font-weight 200
        line-height 12px
      .support
        margin 10px 0 0 0
        .support-ico
          vertical-align top
          margin-right 4px
        .text
          display inline-block
          vertical-align top
          margin-top 1px
          font-size $fontsize-small-s
          font-weight 200
          line-height 12px
    .support-count
      position absolute
      right 12px
      bottom 42px
      padding 7px 8px
      height 10px
      line-height 10px
      border-radius 14px
      font-size 0
      text-align center
      background $color-background-sss
      color $color-white
      .count
        display inline-block
        vertical-align middle
        font-size $fontsize-small-s
        font-weight 200
        line-height 12px
      i
        display inline-block
        vertical-align middle
        font-size $fontsize-small-s
  .bulletin-wrapper
    display flex
    align-items center
    position absolute
    left 0
    right 0
    bottom 0
    padding 0 12px
    height 28px
    background $color-background-sss
    .bulletin-title
      display inline-block
      vertical-align middle
      width 22px
      height 12px
      background-size 22px 12px
      background-repeat no-repeat
      bg-image('images/bulletin')
    .bulletin-text
      flex 1
      font-size $fontsize-small-s
      margin-top 1px
      font-weight 200
      line-height 28px
      color $color-white
      margin-left 4px
      truncate()
    .icon-keyboard_arrow_right
      width 12px
      margin-left 4px
      color $color-white
  .background
    position absolute
    top 0
    right 0
    bottom 0
    left 0
    z-index -1
    filter blur(10px)
</style>
